﻿function GetData(hphmStart,hphm,hpzl) {
    var hphmNum = $("#"+hphmStart).val() + $("#"+hphm).val();
    var datas;
    $.ajax({
        type: 'Get',
        url: 'AjaxClass.ashx',
        dataType: 'json',
        data: { Action: "GetInfo", HPHM: hphmNum, HPZL: $("#" + hpzl).val() },
        success: function (json) {
            datas = json;
        },
        complete: function (XMLHttpRequest, textStatus) {
            $.selectSuggest(hphm, datas, itemSelectFuntion);
        },
        error: function (xhr) {
        }
    });

    var itemSelectFuntion = function () {
    };
}

function GetPP(pp, xh) {
    var datas;
    $.ajax({
        type: 'Get',
        url: 'AjaxClass.ashx',
        dataType: 'json',
        data: { Action: "GetPP", PP: $("#" + pp).val(), XH: $("#" + xh).val() },
        success: function (json) {
            datas = json;
        },
        complete: function (XMLHttpRequest, textStatus) {
            $.selectSuggest(pp, datas, itemSelectFuntion);
        },
        error: function (xhr) {
        }
    });

    var itemSelectFuntion = function () {
        GetXH(pp, xh);
    };
}

function GetXH(pp, xh) {
    var datas;
    $.ajax({
        type: 'Get',
        url: 'AjaxClass.ashx',
        dataType: 'json',
        data: { Action: "GetXH", PP: $("#" + pp).val(), XH: $("#" + xh).val() },
        success: function (json) {
            datas = json;
        },
        complete: function (XMLHttpRequest, textStatus) {
            $.selectSuggest(xh, datas, itemSelectFuntion);
        },
        error: function (xhr) {
        }
    });

    var itemSelectFuntion = function () {
        if ($("#txtFDJXH").length > 0)
        {
            GetFDJXH(pp, xh, 'txtFDJXH');
        }
    };
}

function GetFDJXH(fdjxh) {
    var datas;
    $.ajax({
        type: 'Get',
        url: 'AjaxClass.ashx',
        dataType: 'json',
        data: { Action: "GetFDJXH", FDJXH: $("#" + fdjxh).val() },
        success: function (json) {
            datas = json;
        },
        complete: function (XMLHttpRequest, textStatus) {
            $.selectSuggest(fdjxh, datas, itemSelectFuntion);
        },
        error: function (xhr) {
        }
    });

    var itemSelectFuntion = function () {
    };
}

function GetFDJXH(pp, xh, fdjxh) {
    var datas;
    $.ajax({
        type: 'Get',
        url: 'AjaxClass.ashx',
        dataType: 'json',
        data: { Action: "GetFDJXHEx", PP: $("#" + pp).val(), XH: $("#" + xh).val() },
        success: function (json) {
            datas = json;
        },
        complete: function (XMLHttpRequest, textStatus) {
            $.selectSuggest(fdjxh, datas, itemSelectFuntion);
        },
        error: function (xhr) {
        }
    });

    var itemSelectFuntion = function () {
    };
}


function GetXZQY(xzqy)
{
    var datas;
    $.ajax({
        type: 'Get',
        url: 'AjaxClass.ashx',
        dataType: 'json',
        data: { Action: "GetXZQY", XZQY: $("#" + xzqy).val() },
        success: function (json) {
            datas = json;
        },
        complete: function (XMLHttpRequest, textStatus) {
            $.selectSuggest(xzqy, datas, itemSelectFuntion);
        },
        error: function (xhr) {
        }
    });

    var itemSelectFuntion = function () {
    };
}

var fontElement = $("a,td,input,span,select").not(".keep");
function larger() {
    var fontsize = $("#HiddenFontSize").val();
    if (fontsize == 1) {
        fontElement.css("font-size", "16px");
        $("#HiddenFontSize").val(2);
    } else if (fontsize == 2) {
        fontElement.css("font-size", "18px");
        $("#HiddenFontSize").val(3);
    }
}

function keepfont() {
    var fontsize = $("#HiddenFontSize").val();
    if (fontsize == 2) {
        fontElement.css("font-size", "14px");
        $("#HiddenFontSize").val(1);

    } else if (fontsize == 3) {
        fontElement.css("font-size", "14px");
        $("#HiddenFontSize").val(1);
    }
}

function InitData(oId) {
    jeDate({
        dateCell: oId,//isinitVal:true,
        format: "YYYY-MM-DD",
        isTime: false, //isClear:false,
        minDate: "1900-10-19 00:00:00",
        maxDate: "2099-11-8 00:00:00"
    });
}

document.onkeydown = function (event) {
    try {
        var e = event || window.event || arguments.callee.caller.arguments[0];
        if (e && e.keyCode == $("#hidKeyValue").val()) { // enter 键
            var vIndex = $(document.activeElement).attr("tabindex");

            var vCur = $("input[tabindex$='" + (parseInt(vIndex) + 1).toString() + "']")[0];
            vCur.focus();
            event.returnValue = false;
            return false;
        }
    } catch (ex)
    {
        return false;
    }
};